/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.data.dao;

import com.openbravo.data.basic.BasicException;
import com.openbravo.data.loader.DataRead;
import com.openbravo.data.loader.I_Session;
import com.openbravo.data.loader.SerializerRead;
import com.openbravo.data.loader.query.QBFParameter;
import com.openbravo.data.loader.query.QBFParameters;

import java.util.List;

/**
 *
 * @author Administrator
 */
public abstract class ViewDAO<T> implements SerializerRead<T> {
     protected I_Session s;
 
     I_DeafultFilter filter;
     
     public ViewDAO(I_Session s) {
        this.s = s;
     }

     public ViewDAO(I_Session s,I_DeafultFilter filter) {
         this.s = s;
         this.filter=filter;
      }
    

    public  List<T> list() throws BasicException{
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public List<T> list(Object filter) throws BasicException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public abstract Class getSuportClass();
    
    public List<T> query(QBFParameters filter) throws BasicException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    
	public String getDefaultFilter(String pref){
		if(filter!=null)
			return filter.getDefaultFilter(pref);
		return "(1=1)";
	}

	public List<T> query(QBFParameter filter) throws BasicException {
		throw new UnsupportedOperationException("Not supported yet.");
	}

	 @Override
	public T readValues(DataRead dr) throws BasicException {
		return readValues(dr,null);
	}

	public abstract T readValues(DataRead dr,T obj) throws BasicException;

	public QBFParameters getDAOQBFParameters(String client, String org,
				String user,String pref) {
			return new QBFParameters();
	}
	
	public boolean isCutomerFilter(){
		return false;
	}
}
